class Person {
  public name: string = '';
  // private属性只能在Person类中使用，子类都不可以
  private age: number = 0;
  // gender属性可以在Person类及子类中中使用，但是不可在外部访问
  protected gender: string = ''
  readonly hobby: string = ''

  constructor(name: string, age: number, gender: string) {
    this.name = name
    this.gender = gender
    this.age = age
    this.hobby = '123'; //初始化的时候也可以给readonly属性赋值，就这一次机会了
  }

  protected say() {
    console.log(`hello ${this.name}`);
  }
}

class Student extends Person {
  constructor(name: string, age: number) {
    super(name, age, '男')
    console.log(this.name)
    // console.log(this.age)
    console.log(this.gender)
    console.log(this.hobby)
  }
  public say() {
    super.say()
  }
}

let s = new Student('小黑', 28)
s.say();

// 通过模块作用域做一个隔离哦，防止上面的变量名重复
export {};